package com.du.spring5.proxy;

import org.apache.log4j.Logger;
import org.aspectj.lang.ProceedingJoinPoint;

/**
 * @author : DuJiabao
 * @Date : 2021/2/4 11:03
 * @Project : spring
 * @File : null.java
 * @Desc :
 */
public class UserProxy {
  private final static Logger logger = Logger.getLogger(UserProxy.class);

  /**
   * 前置通知
   */
  public void before() {
    logger.info("before");
  }

  /**
   * 最终通知
   */
  public void after() {
    logger.info("after");
  }
  /**
   * 后置通知（返回通知）
   */
  public void afterReturn() {
    logger.info("afterReturn");
  }

  /**
   * 异常通知
   */
  public void afterThrowing() {
    logger.info("afterThrowing");
  }

  /**
   * 环绕通知
   * @param proceedingJoinPoint
   * @throws Throwable
   */
  public void around(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
    logger.info("around before");
    proceedingJoinPoint.proceed();
    logger.info("around ater");
  }
}
